package br.com.wepa.webapps.orca.logica.modelo;

// Generated 12/01/2007 02:01:35 by Hibernate Tools 3.2.0.beta8

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Menuitem generated by hbm2java
 */
@Entity
@Table(name = "menuitem", catalog = "Orca", uniqueConstraints = {})
public class Menuitem implements java.io.Serializable {

	// Fields    
	/**
	 * 
	 */
	private static final long serialVersionUID = -5555887612398894644L;

	private int idMenuItem;

	private Menuitem menuitem;

	private Funcao funcao;

	private String nome;

	private int ordem;

	private Set<Menuitem> menuitems = new HashSet<Menuitem>(0);

	// Constructors

	/** default constructor */
	public Menuitem() {
	}

	/** minimal constructor */
	public Menuitem(int idMenuItem, String nome, int ordem) {
		this.idMenuItem = idMenuItem;
		this.nome = nome;
		this.ordem = ordem;
	}

	/** full constructor */
	public Menuitem(int idMenuItem, Menuitem menuitem, Funcao funcao,
			String nome, int ordem, Set<Menuitem> menuitems) {
		this.idMenuItem = idMenuItem;
		this.menuitem = menuitem;
		this.funcao = funcao;
		this.nome = nome;
		this.ordem = ordem;
		this.menuitems = menuitems;
	}

	// Property accessors
	@Id
	@Column(name = "idMenuItem", unique = true, nullable = false, insertable = true, updatable = true)
	public int getIdMenuItem() {
		return this.idMenuItem;
	}

	public void setIdMenuItem(int idMenuItem) {
		this.idMenuItem = idMenuItem;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "MenuItem_idMenuItem", unique = false, nullable = true, insertable = true, updatable = true)
	public Menuitem getMenuitem() {
		return this.menuitem;
	}

	public void setMenuitem(Menuitem menuitem) {
		this.menuitem = menuitem;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns( {
			@JoinColumn(name = "Funcao_idFuncao", unique = false, nullable = true, insertable = true, updatable = true),
			@JoinColumn(name = "Funcao_Modulo_idModulo", unique = false, nullable = true, insertable = true, updatable = true) })
	public Funcao getFuncao() {
		return this.funcao;
	}

	public void setFuncao(Funcao funcao) {
		this.funcao = funcao;
	}

	@Column(name = "nome", unique = false, nullable = false, insertable = true, updatable = true)
	public String getNome() {
		return this.nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	@Column(name = "ordem", unique = false, nullable = false, insertable = true, updatable = true)
	public int getOrdem() {
		return this.ordem;
	}

	public void setOrdem(int ordem) {
		this.ordem = ordem;
	}

	@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "menuitem")
	public Set<Menuitem> getMenuitems() {
		return this.menuitems;
	}

	public void setMenuitems(Set<Menuitem> menuitems) {
		this.menuitems = menuitems;
	}

}
